package org.particlethink.entry;

public enum PlanStatus implements IntEnum {
    UnDisposed(1),//待提交
    Submitted(2),//已提交
    Discarded(3);//已作废

    private final int code;

    PlanStatus(int code) {
        this.code = code;
    }//构造函数

    public int getCode() {
        return code;
    }

    public boolean IsUnDisposed() {
        return this == UnDisposed;
    }

    public boolean IsSubmitted() {
        return this == Submitted;
    }

    public boolean IsDiscarded() {
        return this == Discarded;
    }

    public static PlanStatus fromCode(Integer code) {
        if (code == null) {
            return null;
        }
        switch (code) {
            case 1:
                return UnDisposed;
            case 2:
                return Submitted;
            case 3:
                return Discarded;
            default:
                return null;
        }
    }

    public String toString() {
        switch (this) {
            case UnDisposed:
                return "待提交";
            case Submitted:
                return "已提交";
            case Discarded:
                return "已作废";
            default:
                return "";
        }
    }
}

